package com.atguigu.mpdemo101.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * @author abc
 * @version 1.0
 * @date 2021/3/1 23:12
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class User {

    @TableId(type = IdType.ID_WORKER )//mp自带策略，19位值long ID_WORKKER_STR str
    private Long id;

    private String name;
    private Integer age;
    private String email;

    @TableField(fill=FieldFill.INSERT)  //添加的时候会有值输入
    //创建时间
    private Date createTime;
    //@TableField(fill = FieldFill.UPDATE)
    @TableField(fill = FieldFill.INSERT_UPDATE)//插入和更新填充字段
    //修改时间
    private Date updateTime;
    @Version
    @TableField(fill = FieldFill.INSERT)
    private Integer version;//版本号 实现乐观锁

    //删除
    @TableLogic
    @TableField(fill = FieldFill.INSERT)
    private Integer deleted;
}